﻿@using PagedList
@using PagedList.Mvc
@model PMKB_Repository.clsLoadLinks
@{
    ViewBag.Title = PMKB_DAL.PMKBEntities_resource.Link_List;
}
<h2>Links </h2>@PMKB_DAL.PMKBEntities_resource.Link_Found_Generic(Model.links.TotalItemCount) @Html.Raw(string.IsNullOrEmpty(Model.Search) ? "<a href='javascript:SearchLinks()'><small><sub>Search</sub></small></a>" : string.Format("(searching for {0} <small><sub>{1}</sub></small>)", Model.Search, Html.ActionLink("remove", MVC.Link.Index(1, 10, ""))))



    <table>
        <thead>
        <tr>
        <th>Nr.</th>
        <th>@PMKB_DAL.PMKBEntities_resource.Link_LinkName_Label</th>
        <th>@PMKB_DAL.PMKBEntities_resource.Link_LinkDescription_Label</th>
        <th>@PMKB_DAL.PMKBEntities_resource.Link_LinkUrl_Label</th>
         <th>Tags</th>
        <th>Details</th>
         <th>Actions</th>
        </tr>
        </thead>
        <tbody>
            @{int i = Model.links.FirstItemOnPage;}
            @foreach (var item in Model.links)
            {
              
                Html.RenderPartial(MVC.Shared.Views.Link_table, item, new ViewDataDictionary { new System.Collections.Generic.KeyValuePair<string, object>("nr", i) });
                i++;
            }
           
        </tbody>
    </table>
    @if (Model.links.PageCount > 1) { 
        @Html.PagedListPager(Model.links, page => Url.Action(MVC.Link.Index(page,10,Model.Search??"")),PagedListRenderOptions.PageNumbersOnly)
    }
     @Html.ActionLink(PMKB_DAL.PMKBEntities_resource.Link_AddNew, MVC.Link.AddNewItem())
     @Html.ActionLink(PMKB_DAL.PMKBEntities_resource.Tag_List, MVC.Tag.Index())
     
     <script>



         function SearchLinks() {
             Search('@Html.Raw(Url.Action(MVC.Link.Index(1, 10, "aaa")))', 'aaa');

         }
     </script>